<template>
    <div class="inherit f f-ac f-jc" >
        <!-- :style="{backgroundColor: id%2 === '0' ? '#193980' : '#fff'}" -->
        <div class="inherit-body">
            <Sub-title :label="title"  padding="60px 0 10px" color="#fff"/>
            <!-- :color="id%2 === '0' ? '#fff' : '#000'" -->
            <div class="f f-col f-ac f-jc">
                <img src="../../../assets/mountain-white.png" width="261px" height="80px" />
                <div class="fy-title mb-30" >{{title}}</div>
                <!-- :style="{color: id%2 === '0' ? '#fff' : '#000'}" -->
            </div>
            <div class="f f-w">
                <div class="person-item mb-30" v-for="(i, k) in dataList" :key="k" @click="handleDetail(i)">
                    <img :src="baseUrl +i.image" class="photo" />
                    <div class="person-bg">
                        <div class="person-name line-1">{{ i.title || "-" }}</div>
                        <div class="person-describe line-3">{{ i.msg || "-" }}</div>
                    </div>
                </div>
            </div>
            <div class="f f-jc mt-40 mb-40">
                <My-btn label="查看更多" width="198" height="52" bgColor="line-white"
                    @click="handleMore" />
            </div>
        </div>
    </div>
</template>

<script>
    import {
        heritageList
    } from "@/utils/heritage/index.js";
    export default {
        props: {
            // 表单名称
            id: {
                type: Number,
                default: 1,
            },
            title: {
                type: String,
                default: '',
            },
        },
        created() {
            this.getList();
        },
        data() {
            return {
                baseUrl: process.env.VUE_APP_BASE_API,
                dataList: [],
            };
        },

        methods: {
            // 获取传承人列表
            getList() {
                let that = this
                let data = {
                    heritage_category_id: this.id,
                    title: '',
                    type: '',
                    page: 1,
                    limit: 6,
                    recommend: 2
                }
                heritageList(data).then((response) => {
                    that.dataList = response.data.list
                });
            },
            // 查看详情
            handleDetail(v) {
                this.$router.push({
                    path: "/cultural/inheritDetails",
                    query: {
                        id: v.id,
                    },
                });
            },
            // 查看更多
            handleMore() {
                this.$router.push({
                    path: "/cultural/culturalList",
                    query: {
                        // type: "inherit",
                        type: this.id,
                    },
                });
            },
        },
    };
</script>

<style lang="scss" scoped>
    .inherit {
        width: 100%;
        max-height: 1048px;
        background-color: #460202;
        background-image: url("../../../assets/inherit_bg.png");
        background-size: 100% 100%;
        background-repeat: no-repeat;

        &-body {
            width: 1200px;
            height: 100%;

            .fy-title {
                margin-top: 15px;
                color: #fff;
                font-family: FZZhengHeiS-B-GB;
                font-size: 20px;
            }

            .person-item {
                width: 590px;
                height: 190px;
                position: relative;

                &:nth-child(2n-1) {
                    margin-right: 20px;
                }

                &:hover {
                    cursor: pointer;

                    .person-bg {
                        box-shadow: 0px 0px 15px 0px rgba(255, 255, 255, 0.8);
                    }

                    .photo {
                        box-shadow: 5px 5px 4px 0px rgba(81, 81, 81, 0.5);
                    }
                }

                .person-bg {
                    width: 100%;
                    height: 144px;
                    background: #f4f4f4;
                    box-shadow: 0px 0px 15px 0px rgba(255, 255, 255, 0.51);
                    position: relative;

                    .person-name {
                        position: absolute;
                        width: 400px;
                        top: 15px;
                        right: 15px;
                        font-size: 16px;
                        color: #313131;
                        font-weight: 600;
                    }

                    .person-describe {
                        position: absolute;
                        width: 400px;
                        top: 47px;
                        right: 15px;
                        font-size: 14px;
                        color: #313131;
                        line-height: 26px;
                    }
                }

                .photo {
                    position: absolute;
                    top: 15px;
                    left: 15px;
                    width: 144px;
                    height: 184px;
                    z-index: 5;
                    box-shadow: 5px 5px 4px 0px rgba(0, 0, 0, 0.25);
                }
            }
        }
    }
</style>